package com.zb.service.impl;

import cn.hutool.core.collection.CollectionUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zb.entity.ZjWorkFinishOrderTemplateFieldValOption;
import com.zb.mapper.ZjWorkFinishOrderTemplateFieldValOptionMapper;
import com.zb.service.ZjWorkFinishOrderTemplateFieldValOptionService;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 工单结单模板保存字段选项值表 服务实现类
 * </p>
 *
 * @author WEN
 * @since 2024-01-02
 */
@Service
public class ZjWorkFinishOrderTemplateFieldValOptionServiceImpl extends ServiceImpl<ZjWorkFinishOrderTemplateFieldValOptionMapper, ZjWorkFinishOrderTemplateFieldValOption> implements ZjWorkFinishOrderTemplateFieldValOptionService {

    // 根据工单结单模板保存字段值表ID获取字段内容
    @Override
    public List<ZjWorkFinishOrderTemplateFieldValOption> getByWorkFinishOrderTemplateFieldValIds(List<Long> workFinishOrderTemplateFieldValIds) {
        if (CollectionUtil.isEmpty(workFinishOrderTemplateFieldValIds)) {
            return new ArrayList<>();
        }
        QueryWrapper<ZjWorkFinishOrderTemplateFieldValOption> wrapper = new QueryWrapper<>();
        wrapper.select("id", "work_finish_order_template_field_val_id", "opt_value")
                .in("work_finish_order_template_field_val_id", workFinishOrderTemplateFieldValIds);
        return this.list(wrapper);
    }
}
